[IA64] Fix infinite loop in fault handler if debugger is not connected
authorAlex Williamson <alex.williamson@hp.com>
Wed, 30 Jan 2008 18:13:29 +0000 (11:13 -0700)
committerAlex Williamson <alex.williamson@hp.com>
Wed, 30 Jan 2008 18:13:29 +0000 (11:13 -0700)
If xen is compiled with crash_debug=y and the debugger is not
connected, the fault handler enters infinite loop.  regs may
be on stack, so split the incrementing out of vcpu_increment_iip().

Signed-off-by: Kazuhiro Suzuki <kaz@jp.fujitsu.com>
xen/arch/ia64/vmx/vmx_fault.c
xen/arch/ia64/xen/faults.c
xen/arch/ia64/xen/vcpu.c
xen/include/asm-ia64/linux-xen/asm/ptrace.h

index c015bf4ea0d394169f34cb9e826d11065539ebfd..c7bacf337668f1c3e269e001f8663ec61458a1ea 100644 (file)
@@ -181,6 +181,7 @@ vmx_ia64_handle_break (unsigned long ifa, struct pt_regs *regs, unsigned long is
         if (iim == 0)
             show_registers(regs);
         debugger_trap_fatal(0 /* don't care */, regs);
+        regs_increment_iip(regs);
     } else
 #endif
     {
index bf75b630cff1bc968eec628239605c1752fc6cfd..946eb28e4bc8c7115c9dc6f14d904bcfca5e8b57 100644 (file)
@@ -515,6 +515,7 @@ ia64_handle_break(unsigned long ifa, struct pt_regs *regs, unsigned long isr,
                if (iim == 0)
                        show_registers(regs);
                debugger_trap_fatal(0 /* don't care */ , regs);
+               regs_increment_iip(regs);
        }
 #endif
        else if (iim == d->arch.breakimm &&
index 36c9bb2d81ff251c92b7da576eeeebeda0027221..7ba29f3036fd0628b5e5be12e9373f092f21673e 100644 (file)
@@ -804,12 +804,7 @@ IA64FAULT vcpu_set_iip(VCPU * vcpu, u64 val)
 IA64FAULT vcpu_increment_iip(VCPU * vcpu)
 {
        REGS *regs = vcpu_regs(vcpu);
-       struct ia64_psr *ipsr = (struct ia64_psr *)&regs->cr_ipsr;
-       if (ipsr->ri == 2) {
-               ipsr->ri = 0;
-               regs->cr_iip += 16;
-       } else
-               ipsr->ri++;
+       regs_increment_iip(regs);
        return IA64_NO_FAULT;
 }
 
index d44b1da3d5034f155f64c95daf9062daa641d351..97ab9cf15aebf12501c62d7935a9d628d85acd72 100644 (file)
@@ -281,6 +281,15 @@ struct switch_stack {
 # define guest_mode(regs)              (ia64_psr(regs)->cpl != 0)
 # define guest_kernel_mode(regs)       (ia64_psr(regs)->cpl == CONFIG_CPL0_EMUL)
 # define vmx_guest_kernel_mode(regs)   (ia64_psr(regs)->cpl == 0)
+# define regs_increment_iip(regs)                                      \
+do {                                                                   \
+       struct ia64_psr *ipsr = ia64_psr(regs);                         \
+       if (ipsr->ri == 2) {                                            \
+               ipsr->ri = 0;                                           \
+               regs->cr_iip += 16;                                     \
+       } else                                                          \
+               ipsr->ri++;                                             \
+} while (0)
 #else
 # define user_mode(regs)               (((struct ia64_psr *) &(regs)->cr_ipsr)->cpl != 0)
 #endif